{extend name="public:layout" /}
{block name="title"}首页统计{/block}
{block name="head"}
<script src="/public/plugins/template/template.js"></script>
<script src="/public/plugins/echarts/echarts-all.js"></script>
<style>
    .p-lg a{color:#fff;}
</style>
{/block}
{block name="body"}
<h1 class="text-center"><span class="text-danger" id="time">300</span>S后更新数据</h1>
<div class="wrapper wrapper-content">
    <div id="totalTpl"></div>
    <div class="ibox">
        <div class="ibox-title">待办事项</div>
        <div class="ibox-content">
            <div id="todoTpl"></div>
        </div>
    </div>
    <script id="ajaxTodoTpl" type="text/html">
        <div class="row">
            <div class="col-sm-3">
                <div class="widget gray-bg p-lg text-center">
                    <div class="m-b-md">
                        <i class="fa fa-shield fa-4x"></i>
                        <h1 class="m-xs">{{ t1 }}</h1>
                        <h3 class="font-bold no-margins">未付款订单</h3>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget blue-bg p-lg text-center">
                    <div class="m-b-md">
                        <i class="fa fa-shield fa-4x"></i>
                        <h1 class="m-xs">{{ t2 }}</h1>
                        <h3 class="font-bold no-margins">待确认订单</h3>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget yellow-bg p-lg text-center">
                    <div class="m-b-md">
                        <i class="fa fa-shield fa-4x"></i>
                        <h1 class="m-xs">{{ t3 }}</h1>
                        <h3 class="font-bold no-margins">待发货订单</h3>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget red-bg p-lg text-center">
                    <div class="m-b-md">
                        <i class="fa fa-shield fa-4x"></i>
                        <h1 class="m-xs">{{ t4 }}</h1>
                        <h3 class="font-bold no-margins">待处理退款申请单</h3>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget yellow-bg p-lg text-center">
                    <div class="m-b-md">
                        <i class="fa fa-shield fa-4x"></i>
                        <h1 class="m-xs">{{ t5 }}</h1>
                        <h3 class="font-bold no-margins">待处理订单评价</h3>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget navy-bg p-lg text-center">
                    <div class="m-b-md">
                        <i class="fa fa-shield fa-4x"></i>
                        <h1 class="m-xs">{{ t6 }}</h1>
                        <h3 class="font-bold no-margins">待开发票</h3>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget lazur-bg p-lg text-center">
                    <div class="m-b-md">
                        <i class="fa fa-shield fa-4x"></i>
                        <h1 class="m-xs">{{ t7 }}</h1>
                        <h3 class="font-bold no-margins">待处理竞拍</h3>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget blue-bg p-lg text-center">
                    <div class="m-b-md">
                        <i class="fa fa-shield fa-4x"></i>
                        <h1 class="m-xs">{{ t8 }}</h1>
                        <h3 class="font-bold no-margins">待处理集采</h3>
                    </div>
                </div>
            </div>
        </div>
    </script>
    <script id="ajaxTotalTpl" type="text/html">
        <div class="row">
            <div class="col-sm-3">
                <div class="widget style1">
                    <div class="row">
                        <div class="col-xs-4 text-center">
                            <i class="fa fa-trophy fa-5x"></i>
                        </div>
                        <div class="col-xs-8 text-right">
                            <span> 今日概况 </span>
                            <h2 class="font-bold">{{ today_price }}元</h2>
                            <h5 class="font-bold">下单{{ today_total }}笔</h5>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget style1 navy-bg">
                    <div class="row">
                        <div class="col-xs-4">
                            <i class="fa fa-credit-card fa-5x"></i>
                        </div>
                        <div class="col-xs-8 text-right">
                            <span> 昨日概况 </span>
                            <h2 class="font-bold">{{ yesterday_price }}元</h2>
                            <h5 class="font-bold">下单{{ yesterday_total }}笔</h5>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget style1 lazur-bg">
                    <div class="row">
                        <div class="col-xs-4">
                            <i class="fa fa-calendar-o fa-5x"></i>
                        </div>
                        <div class="col-xs-8 text-right">
                            <span> 本月概况 </span>
                            <h2 class="font-bold">{{ month_price }}元</h2>
                            <h5 class="font-bold">下单{{ month_total }}笔</h5>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="widget style1 yellow-bg">
                    <div class="row">
                        <div class="col-xs-4">
                            <i class="fa fa-calendar-minus-o fa-5x"></i>
                        </div>
                        <div class="col-xs-8 text-right">
                            <span> 上月概况 </span>
                            <h2 class="font-bold">{{ last_month_price }}元</h2>
                            <h5 class="font-bold">下单{{ last_month_total }}笔</h5>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </script>
</div>
{/block}
{block name="script"}
<script>
    $(function(){
        setInterval(actionTime,1000);
        setTotalTpl();
        setTodo();
    });
    //定时执行
    function actionTime() {
        var timeText = parseInt($('#time').text());
        if(timeText==1){
            $('#time').text(0);
            setTotalTpl();
            setTodo();
            $('#time').text(300);
        }else{
            var time = timeText-1;
            $('#time').text(time);
        }
    }
    function setTotalTpl() {
        getAjax("{:url('Statistics/mainStats')}",'',function (data) {
            var html = template('ajaxTotalTpl', data);
            $('#totalTpl').html(html);
        })
    }
    function setTodo() {
        getAjax("{:url('getTodo')}",'',function (data) {
            var html = template('ajaxTodoTpl', data);
            $('#todoTpl').html(html);
            top.$('#statics-sum').text(data.total);
            top.$('#statics-t1').text(data.t1);
            top.$('#statics-t2').text(data.t2);
            top.$('#statics-t3').text(data.t3);
            top.$('#statics-t4').text(data.t4);
            top.$('#statics-t5').text(data.t5);
            top.$('#statics-t6').text(data.t6);
            top.$('#statics-t7').text(data.t7);
            top.$('#statics-t8').text(data.t8);
        })
    }
</script>
{/block}
